Chris Pollett > Old Classes >
CS158a

( Print View )

Student Corner:
  [Grades Sec2]

  [Submit Sec2]

  [Class Sign Up Sec2]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Mid]  [Final]

                           












HW#3 --- last modified February 28 2019 22:23:06..

Solution set.

Due date: Apr 8

Files to be submitted:
  Hw3.zip

Purpose:

Related Course Outcomes:

The main course outcomes covered by this assignment are:

LO6 -- Understand network protocols, RIP and OSPF, and the details of IPv4.

LO7 -- Develop a software simulator simulating RIP, OSPF, forwarding and subnetting in IPv4.

Specification:

This HW was originally due Apr. 8, It was extended to Apr. 10 but those submitting before Apr.8 will receive 1 bonus point. There are two parts to this assignment: (1) A written part which should be put in your submitted ZIP file in the file Hw3.pdf. For this part I want you to do the following eight problems out of the text: Chapter 3: 15, 18, 22, 27, 32. Chapter 4: 1, 12, 17. The file Hw3.pdf should clearly indicate all group members in this file. (2) A Java RIP simulator, which will be described below.

After unzipping your homework file the grader will run your RIP simulator will be run from the command line by typing a line like:

java RIPSimulator num_steps test_file

Here num_steps is some number like a 1000 which indicates how many steps the simulator should run for. The parameter test_file is the name of a file containing the network to test the simulator with. The grader will expect you to have a few test files of your experiments handy and will look for a file README.txt to clue her in on your program. A test_file contains the lower triangular part of the adjacency matrix giving a particular network's topology. For example, consider the example below:

3 
-1 7 
6 -1 -1

Each row is for a different router, starting at router 2. Each column is for a different router, starting at router 1. Columns are delimited by 1 or more whitespace characters other than newlines, linefeeds, or carriage returns. The numbers indicate the delay in a particular point-to-point link between the two routers. A negative number indicates the two routers are not connected. So the first row in the example above says router 2 is connected to router 1 by a link with delay 3. The second row says router 3 is not connected to router 1 and is connected to router 2 with a delay of 7. The last row says router 4 is connected to router 1 with a delay of 6 and is not connected to router 2 or router 3.

The main() method of RIPSimulator should first call an Init() method. This should read in the test_file and create an ArrayList of Router objects called routers, one object for each line of the file. A Router object should have an int field called address, a HashMap field called routeTable to maintain routing information and a field called neighbors which is an ArrayList of RouterPort's. A RouterPort should have a field router which specifies the neighboring Router and an int field delay which specifies the line delay of the connection to that router. In the above example, Router 1's neighbors field should contain a RouterPort which has a reference to Router 2 and should contain a RouterPort which has a reference to Router 4. Here is a table which shows for all four Routers the address of Router's contained as RouterPort references in its neighbors ArrayList:

Routerneighbors
12, 4
21, 3
32
41, 4

The constructor for a Router should initialize the routeTable so that it has as entries only those Router's directly connected to it. The keys for this HashMap are Router addresses, the values are RouterEntry's. A RouterEntry consists of an int field called totalPathTime and a RouterPort reference.

The RIPSimulator should have a for loop that cycles over the num_steps of the simulation. At each step, it should first print to standard out, the simulation step number. i.e., something like:

Simulation Step 1
=================

Then it should call each Router's printTable() method to print out the given Router's routeTable. Next it should iterate through its routers Arraylist calling each Router's checkNeighbors() method. This gets for a given Router its neighbor's routing table information before we start doing any updates. After this is done, a simulator step should iterate through the RIPSimulator's routers Arraylist again calling each Router's update() method. This should update the given Router's routeTable using the RIP algorithm according to any information it might have received in the checkNeighbors() phase. This would then complete the simulation step.

To complete our simulator description we need to say a little bit more about the checkNeighbors() method. This method should iterate through the neighbors ArrayList of the given Router and for each RouterPort call its router field's getRouteTable() method to get a deep copy of that Router's routeTable. The returned RouteTables should be stored into an ArrayList field called neighborsRouteTables. It is this array list that is used by the Router's update() method.

Once you are done with your simulator, I want you to create at least three different experiment files to test how well the RIP algorithm converges. These should be listed in your README.txt file. You should have an experiments.txt file where you write up the results of your experiments.

Point Breakdown

Book problems (1/2pt each) 4pts
Departmental Java Coding Guidelines followed 1pt
Classes RIPSimulator, Router, RouterPort, RouterEntry as described (1/2pt each) 2pts
Simulator step works as described, checkNeighbors(), update() methods work, update() correctly implements RIP (1/2pt each) 2pts
Three test files worked and experiments.txt had a detailed summary of your investigations (1/4 pt each). 1pt
Total10pts